import { closestOnCircle } from "ol/coordinate";
import store from "@/store";
import { required } from "../validators";
export const typeListAll = () => {
  return [
    { value: "", label: "待发布" },
    { value: "1", label: "审核中" },
    {
      value: 2,
      label: "已发布"
    }
  ];
};
import { getTypeListByCompanyId } from "@/formRules/common/autoComplete";
export const searchRule = isAdmin => {
  return [
    {
      type: "select",
      hidden: isAdmin ? false : true,
      tableVisible: isAdmin ? true : false,
      title: "单位",
      field: "companyId",
      options: store.state.companyList,
      col: {
        span: 4
      },
      value: store.state.companyId
        ? Number(store.state.companyId)
        : store.state.companyList.length
        ? store.state.companyList[0].value
        : null
    }
  ];
};

export const editRule = isEdirt => {
  return [
    {
      type: "hidden",
      hidden: true,
      field: "id",
      title: "ID",
      value: "",
      prop: "id",
      tableVisible: false
    },
    {
      type: "input",
      field: "categoryName",
      title: "栏目名称",
      label: "栏目名称",
      prop: "categoryName",
      validate: [required()],
      value: "",
      tableVisible: true
    },
    {
      type: "input",
      field: "parentId",
      prop: "parentId",
      title: "parentId",
      value: 0,
      hidden: true,
      tableVisible: false
    },
    {
      label: "操作",
      prop: "control",
      width: "340px",
      type: "template",
      template: "likes"
    }
  ];
};

export const checkPlayForm = () => {
  return [
    {
      field: "dealUser",
      placeholder: "请选择处理人",
      title: "处理人",
      type: "select",
      options: [],
      type_Persons: true,
      rules: [
        {
          message: "请选择处理人",
          trigger: "onBlur"
        }
      ]
    }
  ];
};

export const chuliForm = () => {
  return [
    {
      field: "hiddenImg",
      placeholder: "请选择图片",
      title: "照片",
      type: "upload",
      options: [],
      rules: [
        {
          message: "请选择图片",
          trigger: "onBlur"
        }
      ]
    },
    {
      field: "hiddenDesc",
      placeholder: "请填写描述",
      title: "描述",
      type: "textarea",
      rows: 3,
      options: [],
      rules: [
        {
          message: "请填写描述",
          trigger: "onBlur"
        }
      ]
    }
  ];
};

export const instaShotForm = () => {
  return [
    {
      field: "instaShotsDec",
      placeholder: "请填写描述",
      title: "描述",
      rows: 3,
      type: "textarea",
      rules: [
        {
          message: "请填写描述",
          trigger: "onBlur"
        }
      ]
    },
    {
      field: "instaShotImg",
      placeholder: "",
      title: "报障照片",
      maxCount: 10,
      rows: 2,
      type: "upload",
      rules: [
        {
          message: "请选择图片",
          trigger: "onBlur"
        }
      ]
    }
  ];
};
export const shenheForm = () => {
  return [
    {
      field: "instaShotsDec",
      placeholder: "请填写审核结果描述",
      title: "审核结果描述",
      rows: 3,
      type: "textarea",
      rules: [
        {
          message: "请填写描述",
          trigger: "onBlur"
        }
      ]
    }
    // {
    //   field: "instaShotImg",
    //   placeholder: "",
    //   title: "报障照片",
    //   maxCount: 10,
    //   rows: 2,
    //   type: "upload",
    //   rules: [
    //     {
    //       message: "请选择图片",
    //       trigger: "onBlur"
    //     }
    //   ]
    // }
  ];
};
//后台需要字段
export const regionFrom = () => {
  return [
    {
      field: "createUser",
      placeholder: "请输入发布人",
      title: "发布人",
      rows: 3,
      type: "input",
      rules: [
        {
          message: "请填写发布人",
          trigger: "onBlur"
        }
      ]
    }
  ];
};
